﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using DataAccessClass;

namespace ProducerBO
{
    public class CLIPDETAIL
    {
        iDAC DAC = DACFactory.GetDAC();
        private long _CLIPD_ID = -99;
        private long _CLIP_ID = -99;
        private long _CLIPD_S_ID= -99;
        private string _CLIPD_PHOTO = "";
        private string _CLIPD_LENGTH = "";
        private string _CLIPD_FORMAT = "";
        private string _CLIPD_SIZE = "";
        private long _CLIPD_PRICE = -99;
        //private decimal  _CLIPD_PRICE = -99;
        private bool _ISDELETED = false;
        private bool _ISACTIVE = true;

        public bool ISDELETED
        {
            get
            {
                return _ISDELETED;
            }
            set
            {
                _ISDELETED = value;
            }
        }
        public bool ISACTIVE
        {
            get
            {
                return _ISACTIVE;
            }
            set
            {
                _ISACTIVE = value;
            }
        }
        public long CLIPD_ID
        {
            get
            {
                return _CLIPD_ID;
            }
            set
            {
                _CLIPD_ID = value;
            }
        }
        public long CLIP_ID
        {
            get
            {
                return _CLIP_ID;
            }
            set
            {
                _CLIP_ID = value;
            }
        }
        public long CLIPD_S_ID
        {
            get
            {
                return _CLIPD_S_ID;
            }
            set
            {
                _CLIPD_S_ID = value;
            }
        }
        public string CLIPD_PHOTO
        {
            get
            {
                return _CLIPD_PHOTO;
            }
            set
            {
                _CLIPD_PHOTO = value;
            }
        }
        public String CLIPD_LENGTH
        {
            get
            {
                return _CLIPD_LENGTH;
            }
            set
            {
                _CLIPD_LENGTH = value;
            }
        }
        public string CLIPD_FORMAT
        {
            get
            {
                return _CLIPD_FORMAT;
            }
            set
            {
                _CLIPD_FORMAT = value;   
            }
        }
        public string CLIPD_SIZE
        {
            get
            {
                return _CLIPD_SIZE;
            }
            set
            {
                _CLIPD_SIZE = value;
            }
        }
        public long CLIPD_PRICE
        {
            get
            {
                return _CLIPD_PRICE;
            }
            set
            {
                _CLIPD_PRICE = value;
            }
        }

        public long SaveRecord()
        {
            try
            {
                DbParameter dbparam0 = DAC.Parameter("@CLIPD_ID", CLIPD_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@CLIP_ID", CLIP_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@CLIPD_S_ID", CLIPD_S_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@CLIPD_PHOTO", CLIPD_PHOTO, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@CLIPD_FORMAT", CLIPD_FORMAT, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@CLIPD_LENGTH", CLIPD_LENGTH, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@CLIPD_SIZE", CLIPD_SIZE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@CLIPD_PRICE",CLIPD_PRICE, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);
                

                DbParameter dbparam9 = DAC.Parameter("@ISDELTED", ISDELETED, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6 ,dbparam7,dbparam8,dbparam9};
                return DAC.Save("CLIPDETAIL_SAVE", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long CLIPD_ID, long CLIP_ID, long CLIPD_S_ID, string CLIPD_PHOTO, string CLIPD_FORMAT, string CLIPD_LENGTH, string CLIPD_SIZE, long CLIPD_PRICE, bool ISDELETED, bool ISACTIVE, string andor) 
        {
            try
            {
                 DbParameter dbparam0 = DAC.Parameter("@CLIPD_ID", CLIPD_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = DAC.Parameter("@CLIP_ID", CLIP_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = DAC.Parameter("@CLIPD_S_ID", CLIPD_S_ID, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = DAC.Parameter("@CLIPD_PHOTO", CLIPD_PHOTO, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam4 = DAC.Parameter("@CLIPD_FORMAT", CLIPD_FORMAT, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = DAC.Parameter("@CLIPD_LENGTH", CLIPD_LENGTH, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam6 = DAC.Parameter("@CLIPD_SIZE", CLIPD_SIZE, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam7 = DAC.Parameter("@CLIPD_PRICE",CLIPD_PRICE, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam8 = DAC.Parameter("@ISACTIVE", ISACTIVE, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam9 = DAC.Parameter("@ISDELTED", ISDELETED, DbType.Boolean, ParameterDirection.Input);
                DbParameter dbparam10 = DAC.Parameter("@paraandor", andor, DbType.AnsiString, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5, dbparam6 ,dbparam7,dbparam8,dbparam9,dbparam10};
                DataTable dt = DAC.Select("CLIPDETAIL_GET", dbparamcall);
                return dt;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }


    }
}
